package model;

import java.util.Arrays;
import java.util.Date;

public class ParsedProduct {
	
	private String[] description;
	private float price;
	
	public String[] getDescription() {
		return description;
	}

    public String getStrDescription() {
        StringBuilder prdDescription = new StringBuilder();
        for(String descr: description)
            prdDescription.append(descr).append(" ");
        return prdDescription.toString();
    }
	
	public void setDescription(String[] description) {
		this.description = description;
	}
	
	public float getPrice() {
		return price;
	}
	
	public void setPrice(float price) {
		this.price = price;
	}

	public ParsedProduct(String[] description, float price) {
		this.description = description;
		this.price = price;
	}
	public ParsedProduct() {
		this.description = null;
		this.price = 0.0f;
	}

	@Override
	public String toString() {
		return "ParsedPage [description="
				+ Arrays.toString(description) + 
				", price=" + price + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + Arrays.hashCode(description);
		result = prime * result + Float.floatToIntBits(price);
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ParsedProduct other = (ParsedProduct) obj;
		if (!Arrays.equals(description, other.description))
			return false;
		if (Float.floatToIntBits(price) != Float.floatToIntBits(other.price))
			return false;
		return true;
	}
	
			
}
